package com.blrs.controller;

import java.util.List;

import com.blrs.domain.ProjectDeliverable;
import com.blrs.service.project.deliverable.IProjectDeliverableService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.blrs.common.annotation.Log;
import com.blrs.common.core.controller.BaseController;
import com.blrs.common.core.domain.AjaxResult;
import com.blrs.common.enums.BusinessType;
import com.blrs.common.core.page.TableDataInfo;

/**
 * 项目交付物Controller
 * 
 * @author ruoyi
 * @date 2025-01-14
 */
@RestController
@RequestMapping("/project/deliverable")
public class ProjectDeliverableController extends BaseController
{
    @Autowired
    private IProjectDeliverableService projectDeliverableService;

    /**
     * 查询项目交付物列表
     */
    @GetMapping("/list")
    public TableDataInfo list(ProjectDeliverable projectDeliverable)
    {
        startPage();
        List<ProjectDeliverable> list = projectDeliverableService.selectProjectDeliverableList(projectDeliverable);
        return getDataTable(list);
    }

    /**
     * 新增项目交付物
     */
    @Log(title = "项目交付物", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ProjectDeliverable projectDeliverable)
    {
        return toAjax(projectDeliverableService.insertProjectDeliverable(projectDeliverable));
    }

    /**
     * 修改项目交付物
     */
    @Log(title = "项目交付物", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ProjectDeliverable projectDeliverable)
    {
        return toAjax(projectDeliverableService.updateProjectDeliverable(projectDeliverable));
    }


    /**
     * 删除项目交付物
     */
    @Log(title = "项目交付物", businessType = BusinessType.DELETE)
	@DeleteMapping("/{deliverableId}")
    public AjaxResult remove(@PathVariable String deliverableId)
    {
        return toAjax(projectDeliverableService.deleteProjectDeliverableByDeliverableId(deliverableId));
    }
}
